//
//  MDSharePerferenceHandler.m
//  MideaWorld_Zizhu
//
//  Created by Minus on 6/19/15.
//  Copyright (c) 2015 Minus. All rights reserved.
//

#import "MDSharePerferenceHandler.h"

@implementation MDSharePerferenceHandler

- (void)delete__WithNSString:(NSString *)key
{
    [[NSUserDefaults standardUserDefaults] removeObjectForKey:key];
    [[NSUserDefaults standardUserDefaults] synchronize];
}

- (NSString *)getWithNSString:(NSString *)key
{
    NSString *value = [[NSUserDefaults standardUserDefaults] stringForKey:key];
    
    if (!value)
    {
        value = @"";
    }
    
    return value;
}

- (void)updateWithNSString:(NSString *)key
              withNSString:(NSString *)value
{
    if (value)
    {
        [[NSUserDefaults standardUserDefaults] setObject:value forKey:key];
    }
    else
    {
        [[NSUserDefaults standardUserDefaults] setObject:@"" forKey:key];
    }
}

@end
